﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //1
            Random ran = new Random();
            int[] arr = new int[10];
            for (int i = 0; i < arr.Length; i++)
            {
                arr[i] = ran.Next(1,11);
                for (int j = 0; j < i; j++)
                {
                    if (arr[j] == arr[i])
                    {
                        i--;
                    }
                }
            }
            foreach (var item in arr)
            {
                Console.Write(item+"|");
            }
            Console.WriteLine();
            //2
            int a1 = ran.Next(0, 5);
            double b1 = ran.NextDouble();
            double c1 = a1 + b1;
            string s1 = c1.ToString("f2");
            Console.WriteLine(s1);
            //3
            int a2 = ran.Next(4, 7);
            double b2 = ran.NextDouble();
            double c2 = a2 + b2;
            string s2 = c2.ToString("f2");
            Console.WriteLine(s2);
            //4
            /*while (true)
            {
                Console.WriteLine("请输入一个邮箱：");
                string str1 = Console.ReadLine();
                Regex r1 = new Regex(@"^(\w)+@(\w)+\.(\w)+$");
                if (r1.IsMatch(str1))
                {
                    Console.WriteLine("输入成功！");
                }
                else
                {
                    Console.WriteLine("输入失败！");
                }
            }*/
            //5
            while (true)
            {
                Console.WriteLine("请输入一个手机号码：");
                string str2 = Console.ReadLine();
                Regex r2 = new Regex(@"^(\+86)*\ [1][3-9](\d){9}$");
                if (r2.IsMatch(str2))
                {
                    Console.WriteLine("输入成功！");
                }
                else
                {
                    Console.WriteLine("输入失败！");
                }
            }
        }
    }
}
